﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;

namespace FizzDevelop
{
	public class ExternalTool
	{
		public string Path;
		public string Name;
	}

	static class ExternalTools
	{
		static public Dictionary<string, ExternalTool> ToolList = new Dictionary<string, ExternalTool>();

		static ExternalTools()
		{
			ToolList.Add("Notepad++", new ExternalTool {Path = @"C:\Program Files (x86)\Notepad++", Name = "notepad++.exe"});
		}

		static public Success Run(string execPath, string execName, List<string> files, string args)
		{
			ProcessStartInfo runInfo = new ProcessStartInfo();
			runInfo.WorkingDirectory = Path.GetDirectoryName(files[0]);
			runInfo.FileName = execPath + "\\" + execName;
			runInfo.Arguments = files[0];
			Process runProcess = new Process();
			runProcess.StartInfo = runInfo;
			bool started = runProcess.Start();
			if (started) return Success.Successful;
			else return Success.Failed;
		}
	}
}
